using Engine;
using Engine.Graphics;
using Game;

namespace SCIENEW {
    public class TechTreeBackgroundShader : Shader {
        public ShaderParameter m_worldViewProjectionMatrixParameter;
        public ShaderParameter m_renderSize;
        public ShaderParameter m_time;

        public readonly ShaderTransforms Transforms;

        public Vector2 RenderSize {
            set => m_renderSize.SetValue(value);
        }

        public float Time {
            set => m_time.SetValue(value);
        }

        public TechTreeBackgroundShader() : base(ShaderCodeManager.GetFast("Shaders/TechTree.vsh"), ShaderCodeManager.GetFast("Shaders/TechTree.psh")) {
            m_worldViewProjectionMatrixParameter = GetParameter("u_worldViewProjectionMatrix", true);
            m_renderSize = GetParameter("u_renderSize", true);
            m_time = GetParameter("u_time", true);
            Transforms = new ShaderTransforms(1);
        }

        public override void PrepareForDrawingOverride() {
            Transforms.UpdateMatrices(1, false, false, true);
            m_worldViewProjectionMatrixParameter.SetValue(Transforms.WorldViewProjection, 1);
        }
    }
}